package com.yeskery.nut.extend.mcp.server;

import com.yeskery.nut.core.*;
import com.yeskery.nut.util.StringUtils;

import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Mcp Stdio 请求对象
 * @author sprout
 * 2025-05-21 11:06
 */
public class StdioRequest implements Request {

    /** 请求数据 */
    private final String requestData;

    /**
     * 构建Mcp Stdio 请求对象
     * @param requestData 请求数据
     */
    public StdioRequest(String requestData) {
        this.requestData = requestData;
    }

    @Override
    public List<String> getHeaders(String key) {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Request Header.");
    }

    @Override
    public Map<String, List<String>> getHeaders() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Request Header.");
    }

    @Override
    public Set<String> getParameterKeys() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Request Parameter.");
    }

    @Override
    public Method getMethod() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Http Request Information.");
    }

    @Override
    public String getOriginalPath() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Http Request Information.");
    }

    @Override
    public String getPath() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Http Request Information.");
    }

    @Override
    public String getProtocol() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Http Request Information.");
    }

    @Override
    public Cookie[] getCookies() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Request Cookie.");
    }

    @Override
    public List<MultipartFile> getFiles(String key) {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Request Parameter.");
    }

    @Override
    public byte[] getBody() {
        return requestData.getBytes(StandardCharsets.UTF_8);
    }

    @Override
    public Map<String, List<String>> getParametersMap() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Request Parameter.");
    }

    @Override
    public Map<String, List<String>> getQueryParametersMap() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Request Parameter.");
    }

    @Override
    public Session getSession() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Session.");
    }

    @Override
    public ServerContext getServerContext() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport ServerContext.");
    }

    @Override
    public boolean isEmpty() {
        return StringUtils.isEmpty(requestData);
    }

    @Override
    public void addAttribute(String name, Object object) {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport RequestContext.");
    }

    @Override
    public void removeAttribute(String name) {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport RequestContext.");
    }

    @Override
    public Object getAttribute(String name) {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport RequestContext.");
    }

    @Override
    public Map<String, Object> getAttributes() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport RequestContext.");
    }

    @Override
    public String getRemoteAddress() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Network Information.");
    }

    @Override
    public String getRemoteHost() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Network Information.");
    }

    @Override
    public int getRemotePort() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Network Information.");
    }

    @Override
    public String getLocalAddress() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Network Information.");
    }

    @Override
    public String getLocalHost() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Network Information.");
    }

    @Override
    public int getLocalPort() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport Network Information.");
    }

    @Override
    public ServerRequestConfiguration getServerRequestConfiguration() {
        throw new UnsupportedOperationException("Mcp Stdio Model UnSupport ServerRequestConfiguration.");
    }
}
